﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using Willson.JsbManager.Comm;

namespace Willson.JsbManager.UI
{
    public partial class UCListViewItem : UserControl
    {
        private string _name;
        private MainForm form;

        public UCListViewItem(MainForm mainForm)
        {
            _name = "";
            form = mainForm;
            InitializeComponent();
        }
        
        [Category("自定义"), Description("要打开窗口的对象名称")]
        public string WinformName
        {
            get { return _name; }
            set { _name = value; }
        }

        [Category("自定义"), Description("指定标题上显示的内容")]
        public string ItemCaption
        {
            get { return label_caption.Text; }
            set { label_caption.Text = value; }
        }

        [Category("自定义"), Description("指定备注内容")]
        public string ItemMemo
        {
            get { return label_memo.Text; }
            set { label_memo.Text = value; }
        }

        [EditorBrowsable(EditorBrowsableState.Always), Browsable(true),
                 DefaultValue(false), Category("外观"), Description("指定显示的图片")]
        public Image ItemImage
        {
            set { pbx_main.Image = value; }
        }

        private void label_caption_Click(object sender, EventArgs e)
        {
            WinInfo info = this.Tag as WinInfo;

            if (info.Menu_isshow == 1)
                form.OpenWindows(this.Tag as WinInfo, OpenWindowType.Show);
            else
                form.OpenWindows(this.Tag as WinInfo, OpenWindowType.ShowDialg);
        }
    }
}
